﻿// Open Source: MIT License (http://www.opensource.org/licenses/mit-license.php)
// Project: YoProgramo.NET (http://code.google.com/p/yoprogramo/)
// Autor: Fabian Figueredo (info@fabianfigueredo.com.ar)
// Blog: blog.yoprogramo.net

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Routing;

namespace YoProgramo.Infrastructure.UI.Routes {
    public static class RouteHelper {
        public static void SetRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            /*ADMIN ROUTES*/

            routes.MapRoute(
                "Admin",                                              // Route name
                "administration/{action}/{id}",                           // URL with parameters
                new { controller = "Admin", action = "Index", id = new Int32() }  // Parameter defaults
                );

            routes.MapRoute(
                "AdminByUser",                                              // Route name
                "administration/{action}/byuser/{byuser}/",                           // URL with parameters
                new { controller = "Admin", action = "Index" }  // Parameter defaults
                );

            routes.MapRoute(
                "AdminByUserPage",                                              // Route name
                "administration/{action}/byuser/{byuser}/page/{page}",                           // URL with parameters
                new { controller = "Admin", action = "Index" }  // Parameter defaults
                );

            routes.MapRoute(
                "AdminByStory",                                              // Route name
                "administration/{action}/bystory/{bystory}/",                           // URL with parameters
                new { controller = "Admin", action = "Index" }  // Parameter defaults
                );

            routes.MapRoute(
                "AdminByStoryPage",                                              // Route name
                "administration/{action}/bystory/{bystory}/page/{page}",                           // URL with parameters
                new { controller = "Admin", action = "Index" }  // Parameter defaults
                );


            /*ADMIN ROUTES*/

            routes.MapRoute(
                "ViewWithoutAnswer",                                              // Route name
                "withoutanswer",                           // URL with parameters
                new { controller = "Story", action = "WithoutAnswer" }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewWithoutAnswerPaggin",                                              // Route name
                "withoutanswer/page/{page}",                           // URL with parameters
                new { controller = "Story", action = "WithoutAnswer" }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewWithoutAnswer.mvc",                                              // Route name
                "withoutanswer.mvc",                           // URL with parameters
                new { controller = "Story", action = "WithoutAnswer" }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewWithoutAnswerPaggin.mvc",                                              // Route name
                "withoutanswer.mvc/page/{page}",                           // URL with parameters
                new { controller = "Story", action = "WithoutAnswer" }  // Parameter defaults
                );

            //

            routes.MapRoute(
                "TodaslasPreguntas",                                              // Route name
                "todas",                           // URL with parameters
                new { controller = "Story", action = "Index" }  // Parameter defaults
                );

            routes.MapRoute(
                "TodaslasPreguntasPaggin",                                              // Route name
                "todas/page/{page}",                           // URL with parameters
                new { controller = "Story", action = "Index" }  // Parameter defaults
                );

            routes.MapRoute(
                "TodaslasPreguntas.mvc",                                              // Route name
                "todas.mvc",                           // URL with parameters
                new { controller = "Story", action = "Index" }  // Parameter defaults
                );

            routes.MapRoute(
                "TodaslasPreguntasPaggin.mvc",                                              // Route name
                "todas.mvc/page/{page}",                           // URL with parameters
                new { controller = "Story", action = "Index" }  // Parameter defaults
                );

            //

            routes.MapRoute(
                "AllUsers",                                              // Route name
                "allusers/",                           // URL with parameters
                new { controller = "User", action = "List" }  // Parameter defaults
                );

            routes.MapRoute(
                "AllUsersPaggin",                                              // Route name
                "allusers/page/{page}",                           // URL with parameters
                new { controller = "User", action = "List" }  // Parameter defaults
                );

            routes.MapRoute(
                "AllUsers.mvc",                                              // Route name
                "allusers.mvc/",                           // URL with parameters
                new { controller = "User", action = "List" }  // Parameter defaults
                );

            routes.MapRoute(
                "AllUsersPaggin.mvc",                                              // Route name
                "allusers.mvc/page/{page}",                           // URL with parameters
                new { controller = "User", action = "List" }  // Parameter defaults
                );


            //

            routes.MapRoute(
                "ViewItems",                                              // Route name
                "cat/list/{slug}",                           // URL with parameters
                new { controller = "Category", action = "View", slug = string.Empty }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewItemsPaging",                                              // Route name
                "cat/list/{slug}/page/{page}",                           // URL with parameters
                new { controller = "Category", action = "View", slug = string.Empty }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewItems.mvc",                                              // Route name
                "cat.mvc/list/{slug}",                           // URL with parameters
                new { controller = "Category", action = "View", slug = string.Empty }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewItemsPaging.mvc",                                              // Route name
                "cat.mvc/list/{slug}/page/{page}",                           // URL with parameters
                new { controller = "Category", action = "View", slug = string.Empty }  // Parameter defaults
                );

            //

            routes.MapRoute(
                "ViewTagItems",                                              // Route name
                "tag/list/{slug}",                           // URL with parameters
                new { controller = "Tag", action = "View", slug = string.Empty }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewTagItemsPaging",                                              // Route name
                "tag/list/{slug}/page/{page}",                           // URL with parameters
                new { controller = "Tag", action = "View", slug = string.Empty }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewTagItems.mvc",                                              // Route name
                "tag.mvc/list/{slug}",                           // URL with parameters
                new { controller = "Tag", action = "View", slug = string.Empty }  // Parameter defaults
                );

            routes.MapRoute(
                "ViewTagItemsPaging.mvc",                                              // Route name
                "tag.mvc/list/{slug}/page/{page}",                           // URL with parameters
                new { controller = "Tag", action = "View", slug = string.Empty }  // Parameter defaults
                );


            //
            routes.MapRoute(
                "ViewUserItemsPaging",                                              // Route name
                "user/StoryList/{id}/page/{page}",                           // URL with parameters
                new { controller = "User", action = "StoryList", id = new Int32() }  // Parameter defaults
                );


            routes.MapRoute(
                "ViewUserItemsPaging.mvc",                                              // Route name
                "user.mvc/StoryList/{id}/page/{page}",                           // URL with parameters
                new { controller = "User", action = "StoryList", id = new Int32() }  // Parameter defaults
                );

            //

            //

            routes.MapRoute(
                "ViewUserFavoriteItemsPaging",                                              // Route name
                "user/FavoriteList/{id}/page/{page}",                           // URL with parameters
                new { controller = "User", action = "FavoriteList", id = new Int32() }  // Parameter defaults
                );


            routes.MapRoute(
                "ViewUserFavoriteItemsPaging.mvc",                                              // Route name
                "user.mvc/FavoriteList/{id}/page/{page}",                           // URL with parameters
                new { controller = "User", action = "FavoriteList", id = new Int32() }  // Parameter defaults
                );

            //


            routes.MapRoute(
                "StoryCreate",                                              // Route name
                "story/create",                           // URL with parameters
                new { controller = "Story", action = "Create" }  // Parameter defaults
                );

            routes.MapRoute(
                "StoryCreate.mvc",                                              // Route name
                "story.mvc/create",                           // URL with parameters
                new { controller = "Story", action = "Create" }  // Parameter defaults
                );

            //

            routes.MapRoute(
                "StoryView",                                              // Route name
                "story/{slug}",                           // URL with parameters
                new { controller = "Story", action = "View", slug = string.Empty }  // Parameter defaults
                );

            routes.MapRoute(
                "StoryView.mvc",                                              // Route name
                "story.mvc/{slug}",                           // URL with parameters
                new { controller = "Story", action = "View", slug = string.Empty }  // Parameter defaults
                );

            //

            routes.MapRoute(
                "Default.mvc",                                              // Route name
                "{controller}.mvc/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = new Int32() }  // Parameter defaults
                );

            routes.MapRoute(
                "PagginDefault.mvc",                                              // Route name
                "{controller}.mvc/{action}/Page/{page}",                           // URL with parameters
                new { controller = "Home", action = "Index", page = new Int32() }  // Parameter defaults
                );

            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = new Int32() }  // Parameter defaults
                );

            routes.MapRoute(
                "PagginDefault",                                              // Route name
                "{controller}/{action}/Page/{page}",                           // URL with parameters
                new { controller = "Home", action = "Index", page = new Int32() }  // Parameter defaults
                );

        }
    }
}
